package com.tang.script.command;

import com.tang.script.extrator.VariablesExtractor;
import com.tang.script.variable.Variable;
import com.tang.script.variable.VariablesContainer;
import lombok.Builder;

import java.util.Map;

public class VariableExtractCommand extends AbstractScriptCommand<Map<String, Variable>> {
    @Builder
    public VariableExtractCommand(String scriptText, VariablesContainer variablesContainer) {
        super(scriptText, variablesContainer);
    }

    @Override
    public Map<String, Variable> execute() {
        initCommand();

        VariablesExtractor variablesExtractor = VariablesExtractor.get();
        variablesExtractor.extracte(this);

        return this.getVariables();
    }

    @Override
    public Class getResultClass() {
        return Map.class;
    }
}
